# $Id$
# Maintainer: Kevin Piche <kevin@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>

pkgname=recode
pkgver=3.6
pkgrel=10
pkgdesc="Converts files between various character sets and usages"
arch=('i686' 'x86_64')
url="http://recode.progiciels-bpi.ca/index.html"
license=('GPL' 'LGPL')
depends=('glibc')
source=(${pkgname}-${pkgver}.tar.gz::"https://github.com/pinard/${pkgname}/tarball/v${pkgver}"
        'http://archive.debian.org/debian/pool/main/r/recode/recode_3.6-17.diff.gz'
        'recode-3.6-as-if.patch'
        'recode-3.6-gettextfix.diff')
sha256sums=('a9beecec22be42b1096de74d4dfb1051fa9cd252e4ae149d8aa6b5243d729e5e'
            '57fefbf3a7b7ba9a1feed7c0749a4415c14d0cfc36d5071f354e3962f87b99c7'
            '9ab5b40dd93461ca95c5f5dd197bbe0767c45fe64fb1898f073a24c5705822b5'
            'eb080ec09e508f24974d3bed2dc114d2d8c5d69615e98beea67aa07d4a1e076b')

prepare() {
  cd pinard-Recode-2127b34
  patch -Np1 -i "${srcdir}/recode-3.6-as-if.patch"
  patch -Np1 -i "${srcdir}/recode-3.6-gettextfix.diff"
  patch -Np1 -i "${srcdir}/recode_3.6-17.diff"
  sed -i '1i#include <stdlib.h>' src/argmatch.c
  sed -i -e '/^AM_C_PROTOTYPES/d' -e '/^AUTOMAKE_OPTIONS.*ansi2knr/d' \
    configure.in src/Makefile.am
}

build() {
  cd pinard-Recode-2127b34
  rm -f acinclude.m4
  autoreconf -fi
  libtoolize
  ./configure --prefix=/usr --mandir=/usr/share/man \
    --infodir=/usr/share/info --without-included-gettext
  make
}

package() {
  cd pinard-Recode-2127b34
  make DESTDIR="${pkgdir}" install
}
